<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php 
//有意向的客户
include_once("..\\common.php");
//  防止全局变量造成安全隐患 
$admin = false; 
//  启动会话，这步必不可少 
CheckSalerLogon();


?> 

<?php
$salerid = $_SESSION["salerid"];
$posts = $_POST; 
foreach ($posts as $key => $value) {
	$posts[$key] = trim($value); 
} 
$itemid = $_GET["itemid"];

$DB = DBConnect();
$todotime = $posts["todotime"];
$today = date("Y-m-d");
$resulttime = join(" ",array($today,$todotime) );
echo $resulttime;

$content = $posts["content"];
if($itemid < 0)
{
	$query = "INSERT todolist SET timetodo='$resulttime',content='$content',salerid='$salerid' ";
	echo $query;
	$result = mysql_query($query,$DB);
	if($result)
	{
		header("Location:todolist.php#tabs-0");	
	}
	else
	{
		echo "failed";
	}
	
}
else
{
	$query = "UPDATE todolist SET timetodo='$resulttime',content='$content' WHERE id = $itemid  ";
	$result = mysql_query($query,$DB);
	echo $query;
	if($result)
	{
		header("Location:todolist.php#tabs-0");	
	}
	else
	{
		echo "failed";
	}
}
?>
</body>
</html>